package jmine.tec.report.impl.table;

import java.util.Collections;
import java.util.Map;

import jmine.tec.report.api.RendererParameters;
import jmine.tec.report.api.table.ReportCell;
import jmine.tec.report.api.table.ReportRow;
import jmine.tec.report.impl.RendererParametersImpl;

/**
 * Implementação padrão de linha de relatório
 * 
 * @author lundberg
 * @param <V> tipo de valor
 */
public class ReportRowImpl<V> implements ReportRow<V> {

    private final V record;

    private final Map<String, ReportCell> cellMap;

    private RendererParameters parameters;

    /**
     * Construtor
     * 
     * @param cellMap cellMap
     */
    public ReportRowImpl(Map<String, ReportCell> cellMap) {
        this(null, cellMap);
    }

    /**
     * Construtor
     * 
     * @param record record
     * @param cellMap cellMap
     */
    public ReportRowImpl(V record, Map<String, ReportCell> cellMap) {
        this.record = record;
        this.cellMap = Collections.unmodifiableMap(cellMap);
        this.parameters = new RendererParametersImpl();
    }

    /**
     * {@inheritDoc}
     */
    public Map<String, ReportCell> getCellMap() {
        return this.cellMap;
    }

    /**
     * {@inheritDoc}
     */
    public RendererParameters getParameters() {
        return this.parameters;
    }

    /**
     * {@inheritDoc}
     */
    public V getRecord() {
        return this.record;
    }
}
